from django import forms
from django.contrib.auth.forms import AuthenticationForm

from .models import Article, Profile
from django.contrib.auth.models import User


#
class ProfileForm(forms.ModelForm):
    avatar = forms.ImageField(label='头像', required=False)

    class Meta:
        model = Profile
        fields = ['avatar', ]


class UserForm(forms.ModelForm):
    class Meta:
        model = User
        fields = ['username', 'email']


class PostForm(forms.ModelForm):
    class Meta:
        model = Article
        exclude = []


# class AuthForm(AuthenticationForm):
#     def __init__(self, *args, **kwargs):
#         super(AuthForm, self).__init__(*args, **kwargs)
#         self.fields['username'].label = '用户名或邮箱'
#         self.fields['password'].help_text = '<a href="/password/reset/">忘记密码'
